package org.example.function;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author lihao
 * @className Function_1
 * @date 2024/1/20
 * @description
 */
public class Function_1 {
    public static void main(String[] args) {

        //map函数接口
//        List<String> collect = Stream.of("a", "b", "c")
////                .map(s -> s.toUpperCase())
////                .collect(Collectors.toList());

        //flatmap函数接口
//        List<String> collect = Stream.of(Arrays.asList("a", "b", "c"), Arrays.asList("1", "2", "3"))
//                .flatMap(num -> num.stream())
//                .collect(Collectors.toList());

        //min函数
//        List<Track> trackList = Arrays.asList(new Track("Bakai", 524), new Track("Violets for Your Furs", 378), new Track("Time Was", 451));
//        Track track1 = trackList.stream().min(Comparator.comparing(track -> track.getTime())).get();
//        System.out.println(track1);

        //reduce求和
//        Integer reduce = Stream.of(1, 2, 3)
//                .reduce(0, (acc, element) -> acc + element);



    }
}
